package citylist

import (
	"go-reptile/crawler/engine"
	"regexp"
)

const cityListRegexp = `<a href="(http://www.zhenai.com/zhenghun/[0-9a-z]+)"[^>]*>([^<]+)</a>`

func ParseCityList(contents []byte,_ string) engine.ParserResult{
	re := regexp.MustCompile(cityListRegexp)
	matches := re.FindAllSubmatch(contents, -1)

	result := engine.ParserResult{}
	for _,m := range matches {
		result.Requests = append(result.Requests, engine.Request{
			Url:					string(m[1]),
			// 对用户页面的parse
			ParserFunc:	ParserCity,
		})
	}
	return result
}
